using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace Backend.JYD.AModel.Models.Mapping
{
    public class CustBaseMap : EntityTypeConfiguration<CustBase>
    {
        public CustBaseMap()
        {
            // Primary Key
            this.HasKey(t => t.CustNo);

            // Properties
            this.Property(t => t.CustNo)
                .IsRequired()
                .HasMaxLength(20);

            this.Property(t => t.CustName)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.PaperType)
                .IsRequired()
                .HasMaxLength(5);

            this.Property(t => t.PaperNo)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.Phone)
                .HasMaxLength(20);

            // Table & Column Mappings
            this.ToTable("CustBase");
            this.Property(t => t.CustNo).HasColumnName("CustNo");
            this.Property(t => t.CustName).HasColumnName("CustName");
            this.Property(t => t.PaperType).HasColumnName("PaperType");
            this.Property(t => t.PaperNo).HasColumnName("PaperNo");
            this.Property(t => t.Phone).HasColumnName("Phone");
            this.Property(t => t.ChanelType).HasColumnName("ChanelType");
            this.Property(t => t.Status).HasColumnName("Status");
            this.Property(t => t.CreateTime).HasColumnName("CreateTime");
            this.Property(t => t.UpdateTime).HasColumnName("UpdateTime");
            this.Property(t => t.OpId).HasColumnName("OpId");
            this.Property(t => t.Type).HasColumnName("Type");
        }
    }
}
